package edu.scau.cxq.gp.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import edu.scau.cxq.gp.entity.InventoryAlert;
import edu.scau.cxq.gp.mapper.InventoryAlertMapper;
import edu.scau.cxq.gp.service.IInventoryAlertService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.scau.cxq.gp.vo.InventoryAlertVO;
import edu.scau.cxq.gp.vo.InventoryAlertVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author CXQ
 * @since 2022-02-13
 */
@Service
public class InventoryAlertServiceImpl extends ServiceImpl<InventoryAlertMapper, InventoryAlert> implements IInventoryAlertService {

    @Autowired
    private InventoryAlertMapper inventoryAlertMapper;


    /**
     * 分页查找库存预警VO对象
     * @param currentPage
     * @param size
     * @param goodsId
     * @param wareId
     * @return
     */
    @Override
    public PageInfo<InventoryAlertVO> getInventoryAlertVOList(Integer currentPage, Integer size, Long goodsId, Long wareId) {
        PageHelper.startPage(currentPage, size);
        List<InventoryAlertVO> inventoryAlertVOS = inventoryAlertMapper.selectInventoryAlertVOList(goodsId, wareId);
        PageInfo<InventoryAlertVO> inventoryAlertVOPageInfo = new PageInfo<>(inventoryAlertVOS);
        return inventoryAlertVOPageInfo;
    }
}
